# -*- coding: UTF-8 -*-
import pprint
from tools.Request_General import BaseAPI


class BusinessForm(BaseAPI):
    """
    业务明细表相关接口
    """

    def save_form(self, payload):
        """
        业务明细表编辑视图保存
        """
        r = self.request_send(json=payload)
        return r

    def get_form(self, payload):
        """
        查询业务明细表编辑视图
        """
        r = self.request_send(params=payload)
        return r

    def save_permission(self, payload):
        """
        业务明细表权限配置保存
        """
        r = self.request_send(json=payload)
        return r

    def enable_access_control(self, payload):
        """
        业务明细表权限控制单元查询
        """
        r = self.request_send(json=payload)
        return r

    def page_permission(self, payload):
        """
        业务明细表权限配置查询分页
        """
        r = self.request_send(json=payload)
        return r

    def save_form_relation(self, payload):
        """
        业务明细表编辑视图保存关联元素关系
        """
        r = self.request_send(json=payload)
        return r

    def get_popups_info(self, payload):
        """
        业务明细表-编辑-弹窗查询
        """
        r = self.request_send(params=payload)
        return r

    def save_form_data(self, payload):
        """
        业务明细表使用视图保存
        """
        r = self.request_send(json=payload)
        return r

    def use_info(self, payload):
        """
        业务明细表使用视图打开
        """
        r = self.request_send(json=payload)
        return r

    def check_data(self, payload):
        """
        业务明细表编辑视图-拖动校验
        """
        r = self.request_send(json=payload)
        return r

    def get_comp_primary_key(self, payload):
        """
        根据component类型按规则获取id
        """
        r = self.request_send(params=payload)
        return r

    def save_custom_js(self, payload):
        """
        业务明细表-编辑-自定义js保存
        """
        r = self.request_send(json=payload)
        return r

    def save_popups(self, payload):
        """
        业务明细表-编辑-弹窗保存
        """
        r = self.request_send(json=payload)
        return r

    def get_create_form_popup(self, payload):
        """
        业务明细表-使用-新建时弹窗查询
        """
        r = self.request_send(params=payload)
        return r

    def use_popup(self, payload):
        """
        业务明细表-使用-弹窗查询
        """
        r = self.request_send(params=payload)
        return r

    def get_form_buttons(self, payload):
        """
        业务明细表-编辑-所有按钮查询
        """
        r = self.request_send(params=payload)
        return r

    def get_form_module_info(self, payload):
        """
        业务明细表-编辑-某区域及区域下信息查询（用作弹窗引用区域）
        """
        r = self.request_send(params=payload)
        return r

    def get_form_modules(self, payload):
        """
        业务明细表-编辑-所有区域查询（只返回id，name)
        """
        r = self.request_send(params=payload)
        return r

    def get_form_templates(self, payload):
        """
        业务明细表-编辑-主体信息查询
        """
        r = self.request_send(json=payload)
        return r

    def get_form_views(self, payload):
        """
        业务明细表-编辑-所有字段查询
        """
        r = self.request_send(params=payload)
        return r

    def get_popup_list(self, payload):
        """
        业务明细表-编辑-所有弹窗查询（只返回id和描述）
        """
        r = self.request_send(params=payload)
        return r

    def table_List_for_column(self, payload):
        """
        业务明细表配置页面获取字段可选择的数据表列表
        """
        r = self.request_send(json=payload)
        return r

    def table_List_for_module(self, payload):
        """
        业务明细表配置页面通过模块类型获取模块可选择的数据表列表
        """
        r = self.request_send(json=payload)
        return r

    def permission_access(self, payload):
        """
        业务明细表-编辑-根据分区组件查询权限控制单元列表
        """
        r = self.request_send(params=payload)
        return r

    def permission_buttons(self, payload):
        """
        业务明细表-编辑-根据分区组件查询按钮列表
        """
        r = self.request_send(params=payload)
        return r

    def permission_data(self, payload):
        """
        业务明细表-编辑-权限配置保存到json
        """
        r = self.request_send(json=payload)
        return r

    def permission_modules(self, payload):
        """
        业务明细表-编辑-根据分区组件查询模块区域列表
        """
        r = self.request_send(params=payload)
        return r

    def delete_form_file(self, payload):
        """
        业务明细表-使用-删除附件
        """
        r = self.request_send(json=payload)
        return r

    def use_info_list(self, payload):
        """
        业务明细表-使用-批量打开
        """
        r = self.request_send(json=payload)
        return r

    def module_template(self, payload):
        """
        业务明细表-使用-动态区域查询
        """
        r = self.request_send(params=payload)
        return r


if __name__ == '__main__':
    re = BusinessForm({
        "cookie": "test_deepfos_users=%7B%22color%22%3A%221%22%2C%22email%22%3A%22tianhao.wang%40proinnova.com.cn%22%2C%22invitationActivation%22%3Atrue%2C%22nickName%22%3A%22wth%22%2C%22nickname%22%3A%22wth%22%2C%22token%22%3A%22E1EAAFB7F4BB1631368EC55F3E40D350BA725D75FBA18815E13AA97B5865947A%22%2C%22tokenKey%22%3A%22test_deepfos_token%22%2C%22type%22%3A1%2C%22userId%22%3A%22b72c8c12-2595-48fd-993d-60e5e09e08eb%22%2C%22username%22%3A%22wth2%22%7D; test_deepfos_token=E1EAAFB7F4BB1631368EC55F3E40D350BA725D75FBA18815E13AA97B5865947A; deepfos_users=%7B%22color%22%3A%221%22%2C%22email%22%3A%22tianhao.wang%40proinnova.com.cn%22%2C%22invitationActivation%22%3Atrue%2C%22nickName%22%3A%22wth%22%2C%22nickname%22%3A%22wth%22%2C%22token%22%3A%228F38B8D4D2D2DE3BDB2DFF7C6D720AB60DD76A6895D08675293C7AB460222358%22%2C%22tokenKey%22%3A%22deepfos_token%22%2C%22type%22%3A1%2C%22userId%22%3A%22b72c8c12-2595-48fd-993d-60e5e09e08eb%22%2C%22username%22%3A%22wth2%22%7D; deepfos_token=8F38B8D4D2D2DE3BDB2DFF7C6D720AB60DD76A6895D08675293C7AB460222358",
        "app": "llbtwa004",
        "space": "llbtwa"}, "1.1").save_form_data(
        payload={"topMainKey": {"elementName": "heytea_lease_contract", "folderId": "0"},
                 "templateName": "heytea_lease_contract", "templateFolderId": "0", "templatePath": "",
                 "logicTableName": "heytea_lease_contract", "logicTableFolderId": "0", "logicTableType": "BCUB",
                 "formData": [{"dataTableId": "contract_info@@DIR6004c8061867@@DAT_MYSQL", "dataList": [
                     {"moduleTemplate": "0_74521201", "templateUniKey": "sys_contract_id:EMEOU8B92D2#",
                      "mainKey": "sys_contract_id:EMEOU8B92D2",
                      "values": [{"value": "kkkk", "key": "sys_contract_id", "moduleId": "MOD202202161024169378625"},
                                 {"value": "1", "key": "contract_type", "moduleId": "MOD202202161024169378625"},
                                 {"value": "CNY", "key": "rental_currency", "moduleId": "MOD202202161024169378625"},
                                 {"value": "100101", "key": "cost_center", "moduleId": "MOD202202161024169378625"},
                                 {"value": "0", "key": "is_frozen", "moduleId": "MOD202202161024169378625"},
                                 {"value": "1", "key": "contract_object_type", "moduleId": "MOD202202161024169378625"},
                                 {"value": "0", "key": "is_locked", "moduleId": "MOD202202161024169378625"}]}],
                               "deleteList": []}], "doPre": True, "doPost": True})
    pprint.pprint(re.json())
